Optimize ScheduleSolver pruning and scalability#23
Optimize ScheduleSolver pruning and scalability#23google-labs-jules[bot] wants to merge 1 commit intomainfrom
Conversation
- Fix test_logic.py to match current solver logic (handling Meta-Candidates and selected=True). - Fix unsafe pruning bug in generate_schedules where bonus points (compactness='low') were ignored, causing optimal schedules to be missed. - Optimize pruning condition to use strict inequality (`<=`) when safe, reducing runtime from >70s to <0.01s for cases with many equivalent solutions. - Add tests/test_pruning.py and tests/test_scalability.py to verify correctness and performance.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This change optimizes the backend
ScheduleSolverto address potential performance issues and correctness bugs.compactnessis 'low', adding courses can increase the score (via gap bonuses). The previous pruning logic assumed score monotonically decreases (or stays same), leading to incorrect pruning of optimal schedules. This is fixed by disabling pruning when such bonuses are active.partial < min_heap. This fails to prune branches that have the same score as the current worst solution in the heap. Since we only replace ifnew > min, generating equal-score solutions is wasteful. The condition is updated topartial <= min_heap, which drastically reduces search space (e.g., from 70s to 0.005s in a 10-group stress test).tests/test_logic.pyto align with the current solver implementation (Meta-Candidates returning a single structure for identical times). Addedtests/test_pruning.pyandtests/test_scalability.pyto verify the fixes.PR created automatically by Jules for task 3159618345961881619 started by @OsakaLOOP